package com.ymh.spring.learn.aop.config;

import java.util.ArrayList;
import java.util.List;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

import com.ymh.spring.learn.aop.aspect.TrackCounter;
import com.ymh.spring.learn.aop.service.BlankDiscList;
import com.ymh.spring.learn.aop.service.CompactDisc;

@Configuration
// 声明一个JavaConfig配置类
// @ComponentScan("com.ymh.spring.learn.aop")
// 启用包扫描
@EnableAspectJAutoProxy
// 启用AspectJ自动代理
public class TrackCounterConfig {

	/**
	 * 
	 * <h4>功能：显示声明一个Bean，BeanID为compactDisc</h4>
	 * 
	 * @return
	 */
	@Bean
	public CompactDisc compactDisc() {
		BlankDiscList cd = new BlankDiscList();
		cd.setTitle("Sqt.Pepper");
		cd.setArtist("The Beatles");
		List<String> tracks = new ArrayList<String>();
		tracks.add("1");
		tracks.add("22");
		tracks.add("333");
		tracks.add("4444");
		tracks.add("55555");
		cd.setTracks(tracks);
		return cd;
	}

	
	/**
	 * 
	 * <h4>功能：显示声明一个Bean，BeanID为trackCounter</h4>
	 * @return
	 */
	@Bean
	public TrackCounter trackCounter() {
		return new TrackCounter();
	}

}
